package com.wang.interview;

import java.util.ArrayList;
import java.util.List;

public class BubbleSort implements Sorter{

	public static void main(String[] args) {
		
		BubbleSort sort = new BubbleSort();
		Integer[] list = new Integer[]{10,30,5,8,2};	
		String[] list2 = new String[]{"d","a","c","e","m",};
		sort.sort(list);
		sort.sort(list2);
		for(int i=0;i<list2.length;i++){
			System.out.println(list2[i]);			
		}
	}
	
	
	@Override
	public <T extends Comparable<T>> void sort(T[] list) {		
		for(int i=0;i<list.length-1;i++){
			for(int j=i;j<list.length;j++){
				if(list[i].compareTo(list[j])>0){
					T temp = list[i];
					list[i] = list[j];
					list[j] = temp;					
				}
				
			}			
		}
	}


	@Override
	public <T extends Comparable<T>> void sort(T[] list, Comparable<T> c) {
		// TODO Auto-generated method stub
		
	}
	
}
